﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Download : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            IDAL.IErrorLog errordal = IDAL.DataAccess.CreateErrorLog();
            string msg = string.Empty;

            Entities.ErrorLog error = errordal.Load(Convert.ToInt32(Request.QueryString["ErrorLogID"]));
            if (error != null)
            {
                string path = System.Configuration.ConfigurationManager.AppSettings["HtmlSavepath"] + error.FilePath;
                if (System.IO.File.Exists(path))
                {
                    System.IO.FileInfo file = new System.IO.FileInfo(path);
                    if (file.Length > 0)
                        CommonLib.CShared.ResponseDownloadFile(path);
                    else
                        msg = "文件大小为0";
                }
                else
                    msg = "文件不存在";
            }
            else
                msg = "信息加载错误";

            if (!string.IsNullOrEmpty(msg))
                Response.Write("<script>alert('" + msg + "');</script>");
           // 
        }
    }
}
